#ifndef HDR_TONEMAP_SAMPLE_H
#define HDR_TONEMAP_SAMPLE_H
#include "SampleBase.h"
#include "glslprogram.h"
#include "plane.h"
#include "sphere.h"
#include "objmesh.h"
#include <glm\glm.hpp>
#include "Quad.h"
using glm::vec3;
using glm::vec4;
using glm::mat4;
using glm::mat3;
namespace ShaderLab {
	class HDRSample : public SampleBase {
	public:
		HDRSample();
		~HDRSample();

		void Init();
		void Update(float time);
		void Render();
		void Imgui();
		void ShutDown();
	private:
		GLSLProgram prog;
		GLuint hdrFBO;
		GLuint hdrTex, avgTex;
		mat4 model, view, projection;
		std::unique_ptr<Plane> plane;
		std::unique_ptr<Sphere> sphere;
		std::unique_ptr<Quad> quad;

	private:
		void UpdateMatrix();
		void CreateShader();
		void FBO();
		void Pass1();
		void Pass2();
		void ComputeLogAveLuminance();
		void DrawScene();
	};
}
#endif // !TEMPLATE_SAMPLE_H
